package com.church.daoimpl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.church.dao.CatholicsDao;
import com.church.db.Catholics;

public class CatholicsDaoImpl extends HibernateDaoSupport implements
		CatholicsDao {


	public Catholics getCatholicsById(int id) {
		List<Catholics> list= this.getHibernateTemplate().find("from Catholics where id="+id);
		if(list.size()>0)
		{
			return list.get(0);
		}
		return null;
	}


	public String add(Catholics catholics) {
		this.getHibernateTemplate().save(catholics);
		return "success";
	}


	public String update(Catholics catholics) {
		this.getHibernateTemplate().update(catholics);
		return "success";
	}


	public List<Catholics> getList() {
		return this.getHibernateTemplate().find("from Catholics where state!='3'");
	}

}
